package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.pojo.CustomerOrder;
import com.example.mapper.CustomerOrderMapper;
import com.example.service.ICustomerOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 客户订单表 服务实现类
 * </p>
 *
 * @author wsl
 * @since 2022-04-28
 */
@Service
public class CustomerOrderServiceImpl extends ServiceImpl<CustomerOrderMapper, CustomerOrder> implements ICustomerOrderService {
    @Autowired
    private CustomerOrderMapper customerOrderMapper;
    /**
     * 查询所有
     */
    public List<CustomerOrder> selectAll(){
        QueryWrapper<CustomerOrder> wrapper = new QueryWrapper<CustomerOrder>().orderByDesc("id");
        return customerOrderMapper.selectList(wrapper);
    }
    /**
     * 无条件分页
     * @return
     */
    public PageInfo<CustomerOrder> electByPager(Integer pageNo, Integer pageSize){
        PageHelper.startPage(pageNo,pageSize);
        QueryWrapper<CustomerOrder> wrapper=new QueryWrapper<CustomerOrder>().orderByDesc("id");
        List<CustomerOrder> list=baseMapper.selectList(wrapper);
        return new PageInfo<>(list);
    }
}
